// Message.h	class Message

#ifndef _KC_MESSAGE__H_2008_KC_
#define _KC_MESSAGE__H_2008_KC_

#include <vector>
#include <map>
#include <unicode/unistr.h>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include "Address.h"
#include "Header.h"
#include "BodyPart.h"
#include "Attachment.h"
#include "RawMessage.h"
#include "ContentType.h"
#include "../data/MimeDefaults.h"
 
namespace kc_sf
{
	/** Klasa Message to sparsowana i przygotowana do analizy wiadomość.
	 */
	class Message
	{
		public:

			typedef std::map <std::string, Header *> HeaderCollection;

			RawMessage mRawMessage;
			ContentType mContentType;
			HeaderCollection mHeaders;
			std::vector <BodyPart> mBodyParts;
			std::vector <Attachment *> mAttachments;
			unsigned long mSize;
			Address mFrom;
			AddressCollection mTo;
			AddressCollection mCc;
			AddressCollection mBcc;
			UnicodeString mSubject;

			Message( const RawMessage &rmsg );
			Message( const Message &msg );
			Message & operator = ( const Message &msg );
			virtual ~Message();

			void addHeader(const Header *header);
			void addAttachment(const Attachment *attch);
			void addBodyPart(const BodyPart &body);

			UnicodeString getBody();

			bool isResent() const;

		private:

				void clear();
	};

}

#endif // _KC_MESSAGE__H_2008_KC_
